package bb.lanxing.lib.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;

public class LockableListView extends ListView {
    private boolean mScrollable;

    public LockableListView(Context context) {
        super(context);
        this.mScrollable = true;
    }

    public LockableListView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.mScrollable = true;
    }

    public LockableListView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.mScrollable = true;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        return this.mScrollable && super.onInterceptTouchEvent(motionEvent);
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            if (this.mScrollable) {
                return super.onTouchEvent(motionEvent);
            }
            return false;
        }
        return super.onTouchEvent(motionEvent);
    }

    public boolean isScrollable() {
        return this.mScrollable;
    }

    public void setScrollable(boolean z) {
        this.mScrollable = z;
    }
}
